/**
 *  @file
 *  @brief  载荷组合
 *
 *  @author  wanghuan
 *  @date    2024.05.17
 *  @version  v1.0
 *  @par Copyright(c):  ShenGong  Simulation corporation
 */

#pragma once
#include <vector>

#include "DataStructure/Common/DataStructureNamespace.h"
#include "DataStructure/Common/Id.h"
#include "DataStructure/Common/Real.h"
#include "DataStructure/Common/SetBase.h"
#include "DataStructure/Input/Load/LoadTypes.h"

SG_DATASTRUCTURE_FEM_NAMESPACE_OPEN

/** @brief 一系列载荷集的线性组合
 *
 * {P} = m_facotor * sum (m_subfactor(i) * P(m_subSet(i)))
 */
struct LoadCombination : public SetBase
{
    struct LoadItem
    {
        SG::DataStructure::Common::Real m_subfactor = 0.0;
        SG::DataStructure::Common::Id   m_subSet    = 0;
    };

    SG::DataStructure::Common::Real m_facotor  = 0.0;  ///< 全局载荷系数
    SG::DataStructure::Common::I64  m_domainId = 0;    ///< dominid
    std::vector<LoadItem>           m_Items;           ///< 载荷子集
    static SG::DataStructure::FEM::LoadType GetType ()
    {
        return SG::DataStructure::FEM::LoadType::LOAD_LOAD;
    };
};

DECLSPEC bool operator< (const LoadCombination& SGDataA, const LoadCombination& SGDataB);

/// @brief 对Load 函数进行输出, 供测试使用
DECLSPEC void print (const LoadCombination& load);

SG_DATASTRUCTURE_FEM_NAMESPACE_CLOSE